<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:t="http://myfaces.apache.org/tomahawk"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <h:body>
        <ui:composition>
            <fieldset class="FldStCrtNwPrjct">
                <legend class="LgndCrtNwPrjct">#{msg.CreateNewProject}</legend>
                <h:form>
                    <fieldset class="fldStPrjctDscrptn">
                        <legend>#{msg.description}</legend>

                        <h:outputLabel for="idPrjctFrmAthrNm" value="#{msg.authorName}"/><br/>
                        <h:inputText id="idPrjctFrmAthrNm" value="#{user.name}" disabled="true">
                            <f:validateRegex pattern="[a-zA-Z0-9]"/>
                        </h:inputText>
                        #{projectBean.currentProject.description.setProjectAuthor(user.name)}
                        <br/><br/>

                        <h:outputLabel for="idPrjctNm" value="#{msg.projectName}"/>
                        <h:inputText id="idPrjctNm" value="#{projectBean.currentProject.description.projectName}"/>
                        <br/>

                        <h:outputLabel for="idBtnCrtSmplUnit" value="#{msg.createSimpleUnit}"/><br/>
                        <h:commandButton id="idBtnCrtSmplUnit" class="commandButtonCreateUnit" action="#{projectBean.createSimpleUnit()}" value="create"/>
                        <br/><br/>

                        <h:outputLabel for="idBtnCrtAdvncdUnit" value="#{msg.createAdvancedUnit}"/><br/>
                        <h:commandButton id="idBtnCrtAdvncdUnit" class="commandButtonCreateUnit" action="#{projectBean.createAdvancedUnit()}" value="create"/>


                    </fieldset>

                    <fieldset class="fldStPrjctUnitGnrtn">
                        <legend>#{msg.generateUnits}</legend>
                        <h:form>
                            <h:outputLabel value="#{msg.quantity}"/><br/>
                            <h:inputText id="idTxtInputUnitsQntt" value="#{projectBean.quantity}">
                                <f:validateLongRange minimum="#{projectBean.MINQUANTITY}" maximum="#{projectBean.MAXQUANTITY}"/>
                            </h:inputText><br/>


                            <!--kanskje her skal vi lage select list for å kunne velge mellom simple og advanced mode, nå er det bare simple-->
                            <h:outputLabel for="idSlctItemsLstBx" value="#{msg.location}" /><br/>
                            <t:selectOneListbox id="idSlctItemsLstBx" size="1" onchange="submit()" valueChangeListener="#{projectBean.loadLocationWindow}">
                                <f:selectItems value="#{projectBean.location}"  />
                            </t:selectOneListbox>
                            <br/>


                            <c:if test="#{projectBean.currentLocation eq 'FYLKE'}">
                                <h:outputLabel for="idSlctOneItemListBoxFylker" value="#{msg.choosefylke}"/><br/>
                                <t:selectOneListbox id="idSlctOneItemListBoxFylker" size="1" onchange="submit()" valueChangeListener="#{projectBean._setCurrentFylke}">
                                    <f:selectItems value="#{projectBean.fylker.values()}"  />
                                </t:selectOneListbox>
                            </c:if>

                            <c:if test="#{projectBean.currentLocation eq 'COMMUNE'}">
                                <h:outputLabel for="idSlctOneItemListBoxFylker2" value="#{msg.choosefylke}"/><br/>
                                <t:selectOneListbox id="idSlctOneItemListBoxFylker2" size="1" onchange="submit()" valueChangeListener="#{projectBean.getCommuner}">
                                    <f:selectItems value="#{projectBean.fylker.values()}"  />
                                </t:selectOneListbox>
                                
                                <h:outputLabel for="idSlctOneItemListBoxKommuner" value="#{msg.choosecommune}"/><br/>
                                <t:selectOneListbox id="idSlctOneItemListBoxKommuner" size="1" onchange="submit()" valueChangeListener="#{projectBean._setCurrentCommune}">
                                    <f:selectItems value="#{projectBean.communer.values()}"/>
                                </t:selectOneListbox>
                            </c:if>
                        </h:form>
                    </fieldset>

                    <t:dataTable class="dtTblCrtdUnits">
                        //TODO tomahawk datatable for simple units that have been created before 
                        //TODO tomahawk datatable for advanced units that have been created before
                    </t:dataTable>




                </h:form>
            </fieldset>
        </ui:composition>
    </h:body>
</html>

